﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Data.OleDb;
using BaseData;
using BaseData.Common;

namespace TaxData.OaSys
{
    /// <summary>
    /// OA用户信息
    /// </summary>
    public class UserInfoData
    {
        /// <summary>
        /// 根据用户名获取用户编号
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <returns>用户编号</returns>
        public static int GetID(string userName)
        {
            int userID = 0;
            string sql = "select id from userinf where username=@username";
            OleDbParameter p = new OleDbParameter("@username", OleDbType.VarChar, 50);
            p.Value = userName;
            DataTable dt = DataConfig.QueryRecords(BusinessType.DBemailSystem, sql, p);
            if (dt != null && dt.Rows.Count > 0)
            {
                int.TryParse(dt.Rows[0]["id"].ToString(), out userID);
            }
            return userID;
        }
    }
}
